var  app = getApp();
Page({ 
    /**
     * 页面的初始数据
     */
    data: {        
        province:['鲁','京','津','冀','晋','蒙','辽','吉','黑','沪','苏','浙','皖','闽','赣','豫','鄂','湘','粤','桂','琼','渝','川','贵','云','藏','陕','甘','青','宁','新'],
        type:['港','澳','学','警','领'],
        num:['1','2','3','4','5','6','7','8','9','0'],
        letter:['Q','W','E','R','T','Y','U','O','P','A','S','D','F','G','H','J','K','L','Z','X','C','V','B','N','M'],
        plate:['鲁','','','','','',''],
        number:1,
        save:1
 
    }, 
   onLoad(options) {
      let that=this;
      var status = options.status;
      console.log(status);
      if(status == undefined){
          status=-1;
      }
      this.setData({
          currentTab:status 
      })
      var open=wx.getStorageSync('open');
      wx.showShareMenu({
          menus: ['shareAppMessage', 'shareTimeline'],
          success(res) {
            console.log(res)
          },
          fail(e) {
            console.log(e)
          }
        })             
      that.setData({
          platform:app.globalData.platform,    
          open:open,
          width:app.globalData.windowWidth,
          height:app.globalData.windowHeight,
          statusBarHeight:app.globalData.statusBarHeight,
          navHeight:app.globalData.navHeight,
          marginTop:app.globalData.navTitleTop,
          domain:app.globalData.domain,
          uploadUrl:app.globalData.uploadUrl,
        })
  },
    goBack:function(){
      wx.navigateBack();
    },
    showModals:function(msg,url,index){
      wx.showModal({
          title: '系统提示',
          content:msg,
          success:function(res){
            console.log(res)
             if(res.confirm){
              if(url){
                if(index == 'index'){
                  wx.reLaunch({
                    url: url,
                  })
                }else{
                  wx.navigateTo({
                    url: url,
                  })
                }
              }
             }
             if(res.cancel){

             }
          }
      })
  },
  goBack:function(){
    wx.navigateBack();
  },
  showModals:function(msg,url,index){
    wx.showModal({
        title: '系统提示',
        content:msg,
        success:function(res){
          console.log(res)
           if(res.confirm){
            if(url){
              if(index == 'index'){
                wx.reLaunch({
                  url: url,
                })
              }else{
                wx.navigateTo({
                  url: url,
                })
              }
            }
           }
           if(res.cancel){

           }
        }
    })
},
call(e){
  console.log(e)
  var phone =e.currentTarget.dataset.phone;
  wx.makePhoneCall({
    phoneNumber: phone,
  })
},
goto:function(e){
  console.log(e);
  var url=e.currentTarget.dataset.url;
  var index=e.currentTarget.dataset.index;
  var parent_id=wx.getStorageSync('parent_id');
  if(url=="#"){

  }else if(index=='index'){
      wx.reLaunch({
        url: url,
      })
  }else{
      wx.navigateTo({
        url: url,
      })
  }
  console.log(url);
},
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
     this.getList();
  },
 getList(){
  let that=this;
  let data=this.data;
  var open=wx.getStorageSync('open');
 
  wx.request({
    url: app.globalData.domain+'wechat/car/getList',
    data:{from:1,open_id:open.id},
    success:res=>{
      var data=res.data;
      console.log(data);
      that.setData({
        list:data.list,
        count:data.count
      })
    }
})
 },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})